home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-08-18 | 2.3 KB | 79 lines | [TEXT/PJMM] |
- unit WriteMsg;
-
- interface
-
- uses
- FlipGlobals, HelloTabby, TxWrite;
-
- function TwoDigit (Number: integer): str255;
- function TimeStamp (Separator: str255): str255;
- procedure SendMessage (Destination, FromName, TheFile: str255);
-
- implementation
-
- {----------------------------------------------------------------- }
-
- function TwoDigit;
-
- { Function changes two-digit number to a two-character string. }
-
- begin
- TwoDigit := concat(StringOf(Number div 10 : 1), StringOf(Number mod 10 : 1))
- end;
-
- {----------------------------------------------------------------- }
-
- function TimeStamp;
-
- var
- DateString, TimeString: str255;
- Today: DateTimeRec;
-
- begin
- GetTime(Today);
-
- { The TwoDigit function in the following section turns a two-digit integer }
- { into a two-character string. If there are fewer than two digits, the string }
- { contains a leading '0'. }
-
- if Separator = '/' then
- TimeStamp := concat(TwoDigit(Today.Month), '/', TwoDigit(Today.Day), '/', TwoDigit(Today.Year - 1900))
- else
- TimeStamp := concat(TwoDigit(Today.Hour), ':', TwoDigit(Today.Minute), ':', TwoDigit(Today.Second))
- end;
-
- {----------------------------------------------------------------- }
-
- procedure SendMessage;
-
- var
- ConfigRef, GenericRef: integer;
- NodeID: str255;
-
- begin
- Err := FSOpen(':Tabby:Tabby Config', vRefNum, ConfigRef);
- if Err = NoErr then
- Err := ReadALine(ConfigRef, NodeID);
- Err := FSClose(ConfigRef);
- if NodeID[2] = ':' then
- NodeID := copy(NodeID, 3, 255);
- MakeTextFile(concat(GenericPath, 'Generic Export'));
- if Err = NoErr then
- Err := FSOpen(concat(GenericPath, 'Generic Export'), vRefNum, GenericRef);
- if Err = NoErr then
- Err := SetFPos(GenericRef, fsFromLEOF, 0);
- if Err = NoErr then
- Err := WrLn(GenericRef, concat(' M ', ENDLINE, '000', ENDLINE, TimeStamp('/'), ENDLINE, TimeStamp(':')));
- if Err = NoErr then
- Err := WrLn(GenericRef, concat(Destination, ENDLINE, FromName, ENDLINE, 'Sysop'));
- if Err = NoErr then
- Err := WrLn(GenericRef, concat('File ', TheFile));
- if Err = NoErr then
- Err := WrLn(GenericRef, concat(TheFile, ' was sent to you from node ', NodeID, '.'));
- if Err = NoErr then
- Err := WrLn(GenericRef, concat(ENDLINE, '--- Flip ', Version));
- if Err = NoErr then
- Err := WrLn(GenericRef, NULL);
- Err := FSClose(GenericRef)
- end;
- end.